package cn.yhp.mybatis.session.defaults;

import cn.yhp.mybatis.binding.MapperRegistry;
import cn.yhp.mybatis.session.SqlSession;
import cn.yhp.mybatis.session.SqlSessionFactory;

/**
 * @author yhp
 * @description 默认SqlSessionFactory实现
 * @date 2023/11/8
 */
public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private final MapperRegistry mapperRegistry;


    public DefaultSqlSessionFactory(MapperRegistry mapperRegistry){
        this.mapperRegistry=mapperRegistry;
    }

    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(mapperRegistry);
    }

}
